package com.xcity.game.equip.suit4.impl;

import java.util.List;

import com.xcity.game.combat.Action;
import com.xcity.game.combat.ActionEffect;
import com.xcity.game.combat.attr.CombatAttributeType;
import com.xcity.game.combat.unit.CombatUnit;
import com.xcity.game.common.GameStaticConfig;
import com.xcity.game.equip.suit4.BaseSuit4;
import com.xcity.game.equip.template.EquipSuitEffectTemplate;

/**
 * 爱马仕4件套<br/>
 * 击溃对手员工后恢复{30}%能量
 * @author yang.li
 *
 */
public class Suit4Hermes extends BaseSuit4 {

	public Suit4Hermes(CombatUnit unit, EquipSuitEffectTemplate template) {
		super(unit, template);
	}

	@Override
	public void afterAction(Action action) {
		if (unit.getId() != action.getUnitId()) {
			return;
		}
		List<ActionEffect> effs = action.getEffects();
		for (int i = 0; i < effs.size(); i++) {
			ActionEffect eff = effs.get(i);
			if (eff.getUnit().isDied()) {
				eff = action.addTarget(action.unit);
				float mpDelta = action.unit.getMaxMp() * template.getSuit4Param(0) / GameStaticConfig.percentBase;
				eff.effect(CombatAttributeType.MP, (int) mpDelta);
				break;
			}
		}
	}

}
